﻿using Microsoft.EntityFrameworkCore;
using Abp.Zero.EntityFrameworkCore;
using MPACorePhoneBook.Authorization.Roles;
using MPACorePhoneBook.Authorization.Users;
using MPACorePhoneBook.MultiTenancy;
using MPACorePhoneBook.PhoneBooks.Persons;
using MPACorePhoneBook.PhoneBooks.PhoneNumbers;

namespace MPACorePhoneBook.EntityFrameworkCore
{
    public class MPACorePhoneBookDbContext : AbpZeroDbContext<Tenant, Role, User, MPACorePhoneBookDbContext>
    {
        /* Define a DbSet for each entity of the application */
        
        public MPACorePhoneBookDbContext(DbContextOptions<MPACorePhoneBookDbContext> options)
            : base(options)
        {
        }


        public DbSet<Person> Person { get; set; }

        public DbSet<PhoneNumber> PhoneNubmer { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Person>().ToTable("Person","PB");
            modelBuilder.Entity<PhoneNumber>().ToTable("PhoneNumber", "PB");

            base.OnModelCreating(modelBuilder);
        }
    }
}
